import { getRequest, postRequest, putRequest, deleteRequest } from '@/utils/request.js'

export const commonApi = {
  // 分类
  categoryList: (data) => {
    return getRequest('/v1/admin/category/list', data)
  },
  categorySave: (data) => {
    return postRequest('/v1/admin/category/save', data)
  },
  categoryEdit: (data) => {
    return putRequest('/v1/admin/category/edit', data)
  },
  categoryUpdateStatus: (data) => {
    return putRequest('/v1/admin/category/update/status', data)
  },
  categorySort: (data) => {
    return putRequest('/v1/admin/category/sort', data)
  },
  categoryDelete: (data) => {
    return deleteRequest('/v1/admin/category/delete', data)
  },

  // 标签
  tagList: (data) => {
    return getRequest('/v1/admin/tag/list', data)
  },
  tagSave: (data) => {
    return postRequest('/v1/admin/tag/save', data)
  },
  tagEdit: (data) => {
    return putRequest('/v1/admin/tag/edit', data)
  },
  tagSort: (data) => {
    return putRequest('/v1/admin/tag/sort', data)
  },
  tagDelete: (data) => {
    return deleteRequest('/v1/admin/tag/delete', data)
  },

  // 用户
  usersPage: (data) => {
    return getRequest('/v1/admin/users/page', data)
  },
  usersSave: (data) => {
    return postRequest('/v1/admin/users/save', data)
  },
  usersView: (data) => {
    return getRequest('/v1/admin/users/view', data)
  },
  usersEdit: (data) => {
    return putRequest('/v1/admin/users/edit', data)
  },
  usersUpdateStatus: (data) => {
    return putRequest('/v1/admin/users/update/status', data)
  },
  usersTag: (data) => {
    return postRequest('/v1/admin/users/tag', data)
  },

  // 登录日志
  logLoginPage: (data) => {
    return getRequest('/user/admin/users/log/page', data)
  },

  // 订单
  orderPage: (data) => {
    return getRequest('/v1/admin/order/info/page', data)
  },
  orderEdit: (data) => {
    return putRequest('/v1/admin/order/info/edit', data)
  },
  orderChangePrice: (data) => {
    return putRequest('/v1/admin/order/info/change/price', data)
  }
}
